#if !defined(__CYCLE_H)
#define __CYCLE_H

#include "weather_report.h"
#include <iostream>

template <int Quantum>
struct cycle {
	typedef temps::type_temps type_temps;
	enum { quantum = Quantum };
private:
	type_temps t0_;
public:
	cycle() throw() : t0_(temps::maintenant()) {}
	~cycle() throw() {
		type_temps tps_ecoule = temps::maintenant() - t0_;
		type_temps tps_restant = quantum - tps_ecoule;
		
		if(tps_restant > 0)
			temps::attendre(tps_restant);
		/*else
			std::cout << "Contrainte de constance niquée (" << tps_ecoule << "ms > " << quantum << "ms)" << std::endl;*/

	}
};

#endif
